Data Formats
M64
Movies (.m64 files, also called "m64s") are the storage formats for TASes created using Mupen64.
They are made up of a 1024-byte long header, followed by a variable-size sequence of input samples.
| Offset | Type | Name | Additional Info |
|---|---|---|---|
0x000 |
uint8_t[4] | Magic | Must be 0x4D36341A |
0x004 |
uint32_t | Version | Must be 3 |
0x008 |
uint32_t | UID | Used to correlate a movie with its savestate |
0x00C |
uint8_t | VIs | The amount of VIs during the recording. |
0x010 |
uint32_t | Rerecord count (Low) | The lower dword of the number of savestates loaded while recording the movie. If the count exceeds 0xFFFFFFFF, the upper half from the extended data section is also used. |
0x014 |
uint8_t | VI/s | The amount of VIs generated per second. Can also be determined using the country code. |
0x015 |
uint8_t | Controller count | The amount of connected controllers Must be lower than or equal to 4Can also be determined using the controller flags. |
0x016 |
uint8_t | Extended version | The version number of the extended section. See extended format section. |
0x017 |
uint8_t | Extended flags | The extended flags. See extended format section. |
0x018 |
uint32_t | Sample count | Number of input samples. Determines the element count of the input stream beginning at offset 0x400. |
0x01C |
uint16_t | Start type | The movie start type.1 - Start from savestate2 - Start from reset4 - Start from EEPROM |
0x01E |
uint8_t[2] | Reserved | Must be zero-filled |
0x020 |
uint32_t | Controller flags | The controller flags, a bitfield containing data for each controller sequentially.n - Presentn+4 - Mempakn+8 - RumblepakSubstitute n for the controller index (relative to 0). |
0x024 |
uint8_t[32] | Extended data | The extended data. See extended format section. |
0x044 |
uint8_t[128] | Reserved | Must be zero-filled |
0x0C4 |
char[32] (ASCII) | ROM Name | The name of the ROM the movie was recorded on |
0x0E4 |
uint32_t | ROM CRC | The CRC of the ROM the movie was recorded on |
0x0E8 |
uint16_t | ROM Country Code | The country code of the ROM the movie was recorded on |
0x0EA |
uint8_t[56] | Reserved | Must be zero-filled |
0x122 |
char[64] (ASCII) | Video Plugin Name | The name of the video plugin used during movie recording |
0x162 |
char[64] (ASCII) | Audio Plugin Name | The name of the audio plugin used during movie recording |
0x1A2 |
char[64] (ASCII) | Input Plugin Name | The name of the input plugin used during movie recording |
0x1E2 |
char[64] (ASCII) | RSP Plugin Name | The name of the RSP plugin used during movie recording |
0x222 |
char[222] (UTF-8) | Author | The movie's author |
0x300 |
char[256] (UTF-8) | Description | Additional info about the movie |
0x400 |
uint32_t[sample_count] | Input data | Array of input data of element count Sample countSee input sample section. |
Input Sample
An input sample consists of 32 bits and represents the input state for a specific frame.
It is structured as follows:
| Bit length | Name | Additional info |
|---|---|---|
| 1 | C-Right | |
| 1 | C-Left | |
| 1 | C-Down | |
| 1 | C-Up | |
| 1 | R | |
| 1 | L | |
| 1 | Reserved (1) | If both reserved fields are set, the emulator will reset on that frame. |
| 1 | Reserved (2) | |
| 1 | D-Right | |
| 1 | D-Left | |
| 1 | D-Down | |
| 1 | D-Up | |
| 1 | Start | |
| 1 | Z | |
| 1 | B | |
| 1 | A | |
| 8 | Joystick X | Interpreted as int8_t |
| 8 | Joystick Y | Interpreted as int8_t |
Extended Format
The extended format is an updated version of the M64 format.
It keeps the same version number for compatibility reasons, but defines new data in the data gaps of the old format.
Version mapping
The mapping of Mupen64 versions to extended version numbers is as follows:
| Mupen version | Extended version |
|---|---|
| < 1.1.9 | 0 |
| 1.1.9 | 1 |
| 1.1.9-x | 1 |
Flags
| Bit | Name | Additional Info |
|---|---|---|
| 0 | WiiVC | Whether the movie was recorded with WiiVC emulation mode enabled. Valid on versions: 1 |
| Rest | Reserved | Must be 0, or a warning will be shown on playback. |
ST
Mupen64 will create savestates compressed using gzip by default.
Both gzip-compressed and uncompressed savestates can be loaded by Mupen64.
| Offset | Length (bytes) | Description |
|---|---|---|
0x0 |
32 | Current ROM's MD5 Hash |
0x20 |
40 | RDRAM registers |
0x48 |
36 | MI registers |
0x6c |
52 | PI registers |
0xA0 |
52 | SP registers |
0xD4 |
8 | RSP register |
0xDC |
16 | SI registers |
0xEC |
60 | VI registers |
0x128 |
32 | RI registers |
0x148 |
40 | AI registers |
0x170 |
48 | DPC registers |
0x1A0 |
16 | DPS registers |
0x1B0 |
8388608 | RDRAM - Always 8MB since there's no option to disable expansion slot |
0x8001B0 |
4096 | SP DMEM |
0x8011B0 |
4096 | SP IMEM |
0x8021B0 |
64 | PIF RAM |
0x8021F0 |
4 | Flashram active |
0x8021F4 |
4 | Flashram mode |
0x8021F8 |
8 | Flashram status |
0x802200 |
4 | Flashram erase offset |
0x802204 |
4 | Flashram write pointer |
0x802208 |
1048576 | TLB LUT R |
0x902208 |
1048576 | TLB LUT W |
0xA02208 |
4 | LLBit register |
0xA0220C |
256 | CPU registers |
0xA0230C |
256 | MMU registers |
0xA0240C |
8 | lo register |
0xA02414 |
8 | hi register |
0xA0241C |
256 | FPU registers |
0xA0251C |
4 | FCR0 register |
0xA02520 |
4 | FCR31 register (FPU status) |
0xA02524 |
1664 | TLB E |
0xA02BA4 |
4 | PC register |
0xA02BA8 |
4 | next interrupt |
0xA02BAC |
4 | next VI |
0xA02BB0 |
4 | VI field |
0xA02BB4 |
- | Interrupt queue. Arbitrary-length sequence of uint32_t.Ends with 0xFFFFFFFF. |
0xA02BB4 + Interrupt queue length |
4 | Savestate belongs to a movie? |
| VCR freeze buffer (only if this savestate belongs to a movie): | ||
0xA02BB8 + Interrupt queue length |
4 | VCR freeze buffer length (bytes) |
0xA02BBC + Interrupt queue length |
4 | Movie UID |
0xA02BC0 + Interrupt queue length |
4 | Input frame count when this ST was made |
0xA02BC4 + Interrupt queue length |
4 | VI frame count when this ST was made |
0xA02BC8 + Interrupt queue length |
4 | Sample count - Movie's length sample count when this ST file was made |
0xA02BCC + Interrupt queue length |
4 * (Sample count + 1) | Movie input data up till point of ST creation |
| Video buffer (only present if user enabled it): | ||
0xA02BCC + Interrupt queue length + 4 * (Sample count + 1) |
4 | Video section identifier - 0x53435200 (st file ends here on savestates without this section) |
0xA02BCC + Interrupt queue length + 4 * (Sample count + 1) + 4 |
4 | Video buffer width |
0xA02BCC + Interrupt queue length + 4 * (Sample count + 1) + 8 |
4 | Video buffer height |
0xA02BCC + Interrupt queue length + 4 * (Sample count + 1) + 12 |
width * height * 3 | Video buffer data |